package com.suneast.suneaststore.ui.recycler.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by zestz on 2018/3/27.
 */

public class SpaceItemDecoration extends RecyclerView.ItemDecoration {

    private int leftMargin;
    private int rightMargin;
    private int topMargin;
    private int bottomMargin;

    public SpaceItemDecoration(int leftMargin, int rightMargin, int topMargin, int bottomMargin) {
        this.leftMargin = leftMargin;
        this.rightMargin = rightMargin;
        this.topMargin = topMargin;
        this.bottomMargin = bottomMargin;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.left = leftMargin;
        outRect.right = rightMargin;
        outRect.top = topMargin;
        outRect.bottom = bottomMargin;
    }
}